<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang xml:lang>
<head>
  <meta http-equiv='X-UA-Compatible' content='IE=edge' />
  <meta http-equiv='MSThemeCompatible' content='Yes'>

  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <title>CComplex Class</title>
  <style type="text/css">
      code{white-space: pre-wrap;}
      span.smallcaps{font-variant: small-caps;}
      span.underline{text-decoration: underline;}
      div.column{display: inline-block; vertical-align: top; width: 50%;}
  </style>
  <style type="text/css">@font-face {font-family: octicons-link;src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format('woff');}body {-webkit-text-size-adjust: 100%;text-size-adjust: 100%;color: #333;font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";font-size: 16px;line-height: 1.6;word-wrap: break-word;max-width: 99%;box-sizing: border-box;padding: 20px 5px 8rem 5px; margin-left: auto;margin-right: auto;}body a {background-color: transparent;}body a:active,body a:hover {outline: 0;}body strong {font-weight: bold;}body h1 {font-size: 2em;margin: 0.67em 0;}body img {border: 0;}body hr {box-sizing: content-box;height: 0;}body pre {overflow: auto;}body code,body kbd,body pre {font-family: monospace, monospace;font-size: 1em;}body input {color: inherit;font: inherit;margin: 0;}body html input[disabled] {cursor: default;}body input {line-height: normal;}body input[type="checkbox"] {box-sizing: border-box;padding: 0;}body table {border-collapse: collapse;border-spacing: 0;}body td,body th {padding: 0;}body * {box-sizing: border-box;}body input {font: 13px / 1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";}body a {color: #4078c0;text-decoration: none;}body a:hover,body a:active {text-decoration: underline;}body hr {height: 0;margin: 15px 0;overflow: hidden;background: transparent;border: 0;border-bottom: 1px solid #ddd;}body hr:before {display: table;content: "";}body hr:after {display: table;clear: both;content: "";}body h1,body h2,body h3,body h4,body h5,body h6 {margin-top: 15px;margin-bottom: 15px;line-height: 1.1;}body h1 {font-size: 30px;}body h2 {font-size: 21px;}body h3 {font-size: 16px;}body h4 {font-size: 14px;}body h5 {font-size: 12px;}body h6 {font-size: 11px;}body blockquote {margin: 0;}body ul,body ol {padding: 0;margin-top: 0;margin-bottom: 0;}body ol ol,body ul ol {list-style-type: lower-roman;}body ul ul ol,body ul ol ol,body ol ul ol,body ol ol ol {list-style-type: lower-alpha;}body dd {margin-left: 0;}body code {font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;font-size: 12px;}body pre {margin-top: 0;margin-bottom: 0;font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;}body .select::-ms-expand {opacity: 0;}body .octicon {font: normal normal normal 16px/1 octicons-link;display: inline-block;text-decoration: none;text-rendering: auto;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}body .octicon-link:before {content: '\f05c';}body:before {display: table;content: "";}body:after {display: table;clear: both;content: "";}body>*:first-child {margin-top: 0 !important;}body>*:last-child {margin-bottom: 0 !important;}body a:not([href]) {color: inherit;text-decoration: none;}body .anchor {display: inline-block;padding-right: 2px;margin-left: -18px;}body .anchor:focus {outline: none;}body h1,body h2,body h3,body h4,body h5,body h6 {margin-top: 1em;margin-bottom: 16px;font-weight: bold;line-height: 1.4;}body h1 .octicon-link,body h2 .octicon-link,body h3 .octicon-link,body h4 .octicon-link,body h5 .octicon-link,body h6 .octicon-link {color: #000;vertical-align: middle;visibility: hidden;}body h1:hover .anchor,body h2:hover .anchor,body h3:hover .anchor,body h4:hover .anchor,body h5:hover .anchor,body h6:hover .anchor {text-decoration: none;}body h1:hover .anchor .octicon-link,body h2:hover .anchor .octicon-link,body h3:hover .anchor .octicon-link,body h4:hover .anchor .octicon-link,body h5:hover .anchor .octicon-link,body h6:hover .anchor .octicon-link {visibility: visible;}body h1 {padding-bottom: 0.3em;font-size: 1.75em;line-height: 1.2;}body h1 .anchor {line-height: 1;}body h2 {padding-bottom: 0.3em;font-size: 1.5em;line-height: 1.225;}body h2 .anchor {line-height: 1;}body h3 {font-size: 1.25em;line-height: 1.43;}body h3 .anchor {line-height: 1.2;}body h4 {font-size: 1em;}body h4 .anchor {line-height: 1.2;}body h5 {font-size: 1em;}body h5 .anchor {line-height: 1.1;}body h6 {font-size: 1em;color: #777;}body h6 .anchor {line-height: 1.1;}body p,body blockquote,body ul,body ol,body dl,body table,body pre {margin-top: 0;margin-bottom: 16px;}body hr {height: 4px;padding: 0;margin: 16px 0;background-color: #e7e7e7;border: 0 none;}body ul,body ol {padding-left: 2em;}body ul ul,body ul ol,body ol ol,body ol ul {margin-top: 0;margin-bottom: 0;}body li>p {margin-top: 16px;}body dl {padding: 0;}body dl dt {padding: 0;margin-top: 16px;font-size: 1em;font-style: italic;font-weight: bold;}body dl dd {padding: 0 16px;margin-bottom: 16px;}body blockquote {padding: 0 15px;color: #777;border-left: 4px solid #ddd;}body blockquote>:first-child {margin-top: 0;}body blockquote>:last-child {margin-bottom: 0;}body table {display: block;width: 100%;overflow: auto;word-break: normal;word-break: keep-all;}body table th {font-weight: bold;}body table th,body table td {padding: 6px 13px;border: 1px solid #ddd;}body table tr {background-color: #fff;border-top: 1px solid #ccc;}body table tr:nth-child(2n) {background-color: #f8f8f8;}body img {max-width: 100%;box-sizing: content-box;background-color: #fff;}body code {padding: 0;padding-top: 0;padding-bottom: 0;margin: 0;font-size: 85%;background-color: rgba(0,0,0,0.04);border-radius: 3px;}body code:before,body code:after {letter-spacing: -0.2em;content: "\00a0";}body pre>code {padding: 0;margin: 0;font-size: 100%;word-break: normal;white-space: pre;background: transparent;border: 0;}body .highlight {margin-bottom: 16px;}body .highlight pre,body pre {padding: 16px;overflow: auto;font-size: 85%;line-height: 1.45;background-color: #f7f7f7;border-radius: 3px;}body .highlight pre {margin-bottom: 0;word-break: normal;}body pre {word-wrap: normal;}body pre code {display: inline;max-width: initial;padding: 0;margin: 0;overflow: initial;line-height: inherit;word-wrap: normal;background-color: transparent;border: 0;}body pre code:before,body pre code:after {content: normal;}body kbd {display: inline-block;padding: 3px 5px;font-size: 11px;line-height: 10px;color: #555;vertical-align: middle;background-color: #fcfcfc;border: solid 1px #ccc;border-bottom-color: #bbb;border-radius: 3px;box-shadow: inset 0 -1px 0 #bbb;}body .pl-c {color: #969896;}body .pl-c1,body .pl-s .pl-v {color: #0086b3;}body .pl-e,body .pl-en {color: #795da3;}body .pl-s .pl-s1,body .pl-smi {color: #333;}body .pl-ent {color: #63a35c;}body .pl-k {color: #a71d5d;}body .pl-pds,body .pl-s,body .pl-s .pl-pse .pl-s1,body .pl-sr,body .pl-sr .pl-cce,body .pl-sr .pl-sra,body .pl-sr .pl-sre {color: #183691;}body .pl-v {color: #ed6a43;}body .pl-id {color: #b52a1d;}body .pl-ii {background-color: #b52a1d;color: #f8f8f8;}body .pl-sr .pl-cce {color: #63a35c;font-weight: bold;}body .pl-ml {color: #693a17;}body .pl-mh,body .pl-mh .pl-en,body .pl-ms {color: #1d3e81;font-weight: bold;}body .pl-mq {color: #008080;}body .pl-mi {color: #333;font-style: italic;}body .pl-mb {color: #333;font-weight: bold;}body .pl-md {background-color: #ffecec;color: #bd2c00;}body .pl-mi1 {background-color: #eaffea;color: #55a532;}body .pl-mdr {color: #795da3;font-weight: bold;}body .pl-mo {color: #1d3e81;}body kbd {display: inline-block;padding: 3px 5px;font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;line-height: 10px;color: #555;vertical-align: middle;background-color: #fcfcfc;border: solid 1px #ccc;border-bottom-color: #bbb;border-radius: 3px;box-shadow: inset 0 -1px 0 #bbb;}body .task-list-item {list-style-type: none;}body .task-list-item+.task-list-item {margin-top: 3px;}body .task-list-item input {margin: 0 0.35em 0.25em -1.6em;vertical-align: middle;}body :checked+.radio-label {z-index: 1;position: relative;border-color: #4078c0;}</style>
  
    
  
</head>
<body>
<h1 id="ccomplex-class">CComplex Class</h1>
<p><code>CComplex</code> is a class to work with complex numbers with Free Basic. Complex numbers are represented using the type <code>_complex</code>. The real and imaginary part are stored in the members <code>x</code> and <code>y</code>. There is also a flat api version that you can use alone or in combination with this class (see: <a href="https://github.com/JoseRoca/WinFBX/blob/master/docs/Numeric%20datatypes/Complex%20Numbers%20Procedures.md">Complex Numbers Procedures</a></p>
<pre><code>TYPE _complex
   x AS DOUBLE   ' real part
   y AS DOUBLE   ' imaginary part
END TYPE
</code></pre>
<p><strong>Include file</strong>: CComplex.inc.</p>
<h3 id="constructors">Constructors</h3>
<p>Create a new instance of the <strong>CComplex</strong> class and assigns the values passed to it.</p>
<pre><code>CONSTRUCTOR CComplex
CONSTRUCTOR CComplex (BYVAL x AS DOUBLE = 0, BYVAL y AS DOUBLE = 0)
CONSTRUCTOR CComplex (BYREF cpx AS CComplex)
CONSTRUCTOR CComplex (BYREF cpx AS _complex)
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x, y</em></td>
<td>Uses the cartesian components (x,y) to set the real and imaginary parts of the complex number.</td>
</tr>
<tr class="even">
<td><em>cpx</em></td>
<td>An instance of the <strong>CComplex</strong> class or a <strong>_complex</strong> structure.</td>
</tr>
</tbody>
</table>
<h4 id="examples">Examples</h4>
<p>Uses the cartesian components (x,y) to set the real and imaginary parts of the complex number.</p>
<pre><code>DIM cpx AS CComplex = TYPE(3, 4)
DIM cpx2 AS CComplex = cpx
</code></pre>
<p>An instance of the <strong>CComplex</strong> class.</p>
<pre><code>DIM cpx AS CComplex = TYPE(3, 4)
DIM cpx2 AS CComplex = cpx
</code></pre>
<p>A <strong>_complex</strong> structure.</p>
<pre><code>DIM cpx AS CComplex = TYPE&lt;_complex&gt;(3, 4)
</code></pre>
<h3 id="operators">Operators</h3>
<table>
<thead>
<tr class="header">
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><a href="#Operator1">Operator LET</a></td>
<td>Assigns a value to a <strong>CComplex</strong> variable.</td>
</tr>
<tr class="even">
<td><a href="#Operator2">CAST operators</a></td>
<td>Converts a <strong>CComplex</strong> into another data type.</td>
</tr>
<tr class="odd">
<td><a href="#Operator3">Comparison operators</a></td>
<td>Compares complex numbers.</td>
</tr>
<tr class="even">
<td><a href="#Operator4">Math operators</a></td>
<td>Add, subtract, multiply or divide complex numbers.</td>
</tr>
</tbody>
</table>
<h3 id="methods-and-properties">Methods and Properties</h3>
<table>
<thead>
<tr class="header">
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><a href="#CAbs">CAbs</a></td>
<td>Returns the magnitude of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CAbs2">CAbs2</a></td>
<td>Returns the squared magnitude of this complex number, otherwise known as the complex norm.</td>
</tr>
<tr class="odd">
<td><a href="#CAbsSqr">CAbsSqr</a></td>
<td>Returns the absolute square (squared norm) of a complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCos">CACos</a></td>
<td>Returns the complex arccosine of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcCosH">CACosH</a></td>
<td>Returns the complex hyperbolic arccosine of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCosHReal">CACosHReal</a></td>
<td>Returns the complex arccosine of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcCosReal">CACosReal</a></td>
<td>Returns the complex arccosine of a real number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCot">CACot</a></td>
<td>Returns the complex arccotangent of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcCotH">CACotH</a></td>
<td>Returns the complex hyperbolic arccotangent of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCsc">CACsc</a></td>
<td>Returns the complex arccosecant of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcCscH">CACscH</a></td>
<td>Returns the complex hyperbolic arccosecant of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCscReal">CACscReal</a></td>
<td>Returns the complex arccosecant of a real number.</td>
</tr>
<tr class="odd">
<td><a href="#CAdd">CAdd</a></td>
<td>Adds a complex number.</td>
</tr>
<tr class="even">
<td><a href="#CAddImag">CAddImag</a></td>
<td>Adds an imaginary number.</td>
</tr>
<tr class="odd">
<td><a href="#CAddReal">CAddReal</a></td>
<td>Adds a real number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCos">CArcCos</a></td>
<td>Returns the complex arccosine of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcCosH">CArcCosH</a></td>
<td>Returns the complex hyperbolic arccosine of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCosHReal">CArcCosHReal</a></td>
<td>Returns the complex arccosine of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcCosReal">CArcCosReal</a></td>
<td>Returns the complex arccosine of a real number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCot">CArcCot</a></td>
<td>Returns the complex arccotangent of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcCotH">CArcCotH</a></td>
<td>Returns the complex hyperbolic arccotangent of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCsc">CArcCsc</a></td>
<td>Returns the complex arccosecant of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcCscH">CArcCscH</a></td>
<td>Returns the complex hyperbolic arccosecant of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcCscReal">CArcCscReal</a></td>
<td>Returns the complex arccosecant of a real number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcSec">CArcSec</a></td>
<td>Returns the complex arcsecant of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcSecH">CArcSecH</a></td>
<td>Returns the complex hyperbolic arcsecant of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcSecReal">CArcSecReal</a></td>
<td>Returns the complex arcsecant of a real number.</td>
</tr>
<tr class="even">
<td><a href="#CArcSin">CArcSin</a></td>
<td>Returns the complex arcsine of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcSinH">CArcSinH</a></td>
<td>Returns the complex hyperbolic arcsine of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcSinReal">CArcSinReal</a></td>
<td>Returns the complex arcsine of a real number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcTan">CArcTan</a></td>
<td>Returns the complex arctangent of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcTanH">CArcTanH</a></td>
<td>Returns the complex hyperbolic arctangent of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcTanHReal">CArcTanHReal</a></td>
<td>Returns the complex hyperbolic arctangent of a real number.</td>
</tr>
<tr class="even">
<td><a href="#CArg">CArg</a></td>
<td>Returns the argument of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArg">CArgument</a></td>
<td>Returns the argument of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcSec">CASec</a></td>
<td>Returns the complex arcsecant of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcSecH">CASecH</a></td>
<td>Returns the complex hyperbolic arcsecant of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcSecReal">CASecReal</a></td>
<td>Returns the complex arcsecant of a real number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcSin">CASin</a></td>
<td>Returns the complex arcsine of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcSinH">CASinH</a></td>
<td>Returns the complex hyperbolic arcsine of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcSinReal">CASinReal</a></td>
<td>Returns the complex arcsine of a real number.</td>
</tr>
<tr class="even">
<td><a href="#CArcTan">CATan</a></td>
<td>Returns the complex arctangent of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CArcTanH">CATanH</a></td>
<td>Returns the complex hyperbolic arctangent of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CArcTanHReal">CATanHReal</a></td>
<td>Returns the complex hyperbolic arctangent of a real number.</td>
</tr>
<tr class="odd">
<td><a href="#CConjugate">CConj</a></td>
<td>Returns the complex conjugate of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CConjugate">CConjugate</a></td>
<td>Returns the complex conjugate of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CCos">CCos</a></td>
<td>Returns the complex cosine of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CCosH">CCosH</a></td>
<td>Returns the complex hyperbolic cosine of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CCot">CCot</a></td>
<td>Returns the complex cotangent of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CCotH">CCotH</a></td>
<td>Returns the complex hyperbolic cotangent of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CCsc">CCsc</a></td>
<td>Returns the complex cosecant of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CCscH">CCscH</a></td>
<td>Returns the complex hyperbolic cosecant of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CDiv">CDiv</a></td>
<td>Divides by a complex number.</td>
</tr>
<tr class="even">
<td><a href="#CDivImag">CDivImag</a></td>
<td>Divides by an imaginary number.</td>
</tr>
<tr class="odd">
<td><a href="#CDivReal">CDivReal</a></td>
<td>Divides by a real number.</td>
</tr>
<tr class="even">
<td><a href="#CExp">CExp</a></td>
<td>Returns the complex exponential of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CImag">CImag</a></td>
<td>Gets/sets the imaginary part of a complex number.</td>
</tr>
<tr class="even">
<td><a href="#CReciprocal">CInverse</a></td>
<td>Returns the inverse, or reciprocal, of a complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CLog">CLog</a></td>
<td>Returns the complex natural logarithm (base e) of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CLog10">CLog10</a></td>
<td>Returns the complex base-10 logarithm of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CLogAbs">CLogAbs</a></td>
<td>Returns the natural logarithm of the magnitude of a complex number.</td>
</tr>
<tr class="even">
<td><a href="#CAbs">CMagnitude</a></td>
<td>Returns the magnitude of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CModulus">CMod</a></td>
<td>Returns the modulus of a complex number.</td>
</tr>
<tr class="even">
<td><a href="#CModulus">CModulus</a></td>
<td>Returns the modulus of a complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CMul">CMul</a></td>
<td>Multiplies by a complex number.</td>
</tr>
<tr class="even">
<td><a href="#CMulImag">CMulImag</a></td>
<td>Multiplies by an imaginary number.</td>
</tr>
<tr class="odd">
<td><a href="#CMulReal">CMulReal</a></td>
<td>Multiplies by a real number.</td>
</tr>
<tr class="even">
<td><a href="#CNegate">CNeg</a></td>
<td>Negates the complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CNegate">CNegate</a></td>
<td>Negates the complex number.</td>
</tr>
<tr class="even">
<td><a href="#CNegate">CNegative</a></td>
<td>Negates the complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CAbs2">CNorm</a></td>
<td>Returns the squared magnitude of this complex number, otherwise known as the complex norm.</td>
</tr>
<tr class="even">
<td><a href="#CNthRoot">CNthRoot</a></td>
<td>Returns the kth nth root of a complex number where k = 0, 1, 2, 3,...,n - 1.</td>
</tr>
<tr class="odd">
<td><a href="#CArg">CPhase</a></td>
<td>Returns the argument of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CPolar">CPolar</a></td>
<td>Sets the complex number from the polar representation.</td>
</tr>
<tr class="odd">
<td><a href="#CPow">CPow</a></td>
<td>Returns this complex number raised to a complex power or to a real number.</td>
</tr>
<tr class="even">
<td><a href="#CReal">CReal</a></td>
<td>Gets/sets the real part of a complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CSet">CRect</a></td>
<td>Uses the cartesian components (x,y) to set the real and imaginary parts of the complex number.</td>
</tr>
<tr class="even">
<td><a href="#CReciprocal">CReciprocal</a></td>
<td>Returns the inverse, or reciprocal, of a complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CSec">CSec</a></td>
<td>Returns the complex secant of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CSecH">CSecH</a></td>
<td>Returns the complex hyperbolic secant of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CSet">CSet</a></td>
<td>Uses the cartesian components (x,y) to set the real and imaginary parts of the complex number.</td>
</tr>
<tr class="even">
<td><a href="#CSgn">CSgn</a></td>
<td>Returns the sign of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CSin">CSin</a></td>
<td>Returns the complex sine of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CSinH">CSinH</a></td>
<td>Returns the complex hyperbolic sine of this complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CSqr">CSqr</a></td>
<td>Returns the square root of a complex number.</td>
</tr>
<tr class="even">
<td><a href="#CSqr">CSqrt</a></td>
<td>Returns the square root of a complex number.</td>
</tr>
<tr class="odd">
<td><a href="#CSub">CSub</a></td>
<td>Subtracts a complex number.</td>
</tr>
<tr class="even">
<td><a href="#CSubImag">CSubImag</a></td>
<td>Subtracts an imaginary number.</td>
</tr>
<tr class="odd">
<td><a href="#CSubReal">CSubReal</a></td>
<td>Subtracts a real number.</td>
</tr>
<tr class="even">
<td><a href="#CSwap">CSwap</a></td>
<td>Exchanges the contents of two complex numbers.</td>
</tr>
<tr class="odd">
<td><a href="#CTan">CTan</a></td>
<td>Returns the complex tangent of this complex number.</td>
</tr>
<tr class="even">
<td><a href="#CTanH">CTanH</a></td>
<td>Returns the complex hyperbolic tangent of this complex number.</td>
</tr>
</tbody>
</table>
<h3 id="helper-methods">Helper Methods</h3>
<table>
<thead>
<tr class="header">
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><a href="#ArcCosH">ArcCosH</a></td>
<td>Calculates the inverse hyperbolic cosine.</td>
</tr>
<tr class="even">
<td><a href="#ArcTanH">ArcTanH</a></td>
<td>Returns the inverse hyperbolic tangent of a number.</td>
</tr>
<tr class="odd">
<td><a href="#IsInfinity">IsInf</a></td>
<td>Determines whether the argument is an infinity.</td>
</tr>
<tr class="even">
<td><a href="#IsInfinity">IsInfinity</a></td>
<td>Determines whether the argument is an infinity.</td>
</tr>
</tbody>
</table>
<h1 id="operator-let-(=)"><a name="Operator1"></a>Operator LET (=)</h1>
<p>Assigns a value to a CComplex variable.</p>
<pre><code>OPERATOR LET (BYREF z AS CComplex)
OPERATOR LET (BYREF z AS _complex)
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>z</em></td>
<td>An instance of the <strong>CComplex</strong> class or a <strong>_complex</strong> structure.</td>
</tr>
</tbody>
</table>
<p>An instance of the <strong>CComplex</strong> class.</p>
<pre><code>DIM cpx AS CComplex = TYPE(3, 4)
DIM cpx2 AS CComplex = cpx
</code></pre>
<pre><code>DIM cpx AS CComplex
cpx = CComplex(3, 4)
</code></pre>
<p>A <strong>_complex</strong> structure.</p>
<pre><code>DIM cpx AS CComplex = TYPE&lt;_complex&gt;(3, 4)
</code></pre>
<h1 id="operator-cast"><a name="Operator2"></a>Operator CAST</h1>
<p>Returns the underlying <strong>_complex</strong> number.</p>
<pre><code>OPERATOR CAST () AS _complex
OPERATOR CAST () AS STRING
</code></pre>
<h4 id="remarks">Remarks</h4>
<p>This overloaded operator is not called directly.</p>
<p>The second overloaded operator returns the complex number as a formatted string that can be used with the PRINT statement.</p>
<h1 id="comparison-operators"><a name="Operator3"></a>Comparison operators</h1>
<p>Compares complex numbers for equality or inequality.</p>
<pre><code>OPERATOR = (BYREF z1 AS CComplex, BYREF z2 AS CComplex) AS BOOLEAN
OPERATOR &lt;&gt; (BYREF z1 AS CComplex, BYREF z2 AS CComplex) AS BOOLEAN
</code></pre>
<h4 id="exammple">Exammple</h4>
<pre><code>DIM cpx1 AS CComplex = CComplex(1, 2)
DIM cpx2 AS CComplex = CComplex(3, 4)
IF cpx1 = cpx2 THEN PRINT &quot;equal&quot; ELSE PRINT &quot;different&quot;
</code></pre>
<h1 id="math-operators"><a name="Operator4"></a>Math operators</h1>
<pre><code>OPERATOR + (BYREF z1 AS CComplex, BYREF z2 AS CComplex) AS CComplex
OPERATOR + (BYVAL a AS DOUBLE, BYREF z AS CComplex) AS CComplex
OPERATOR + (BYREF z AS CComplex, BYVAL a AS DOUBLE) AS CComplex
OPERATOR - (BYREF z1 AS CComplex, BYREF z2 AS CComplex) AS CComplex
OPERATOR - (BYVAL a AS DOUBLE, BYREF z AS CComplex) AS CComplex
OPERATOR - (BYREF z AS CComplex, BYVAL a AS DOUBLE) AS CComplex
OPERATOR * (BYREF z1 AS CComplex, BYREF z2 AS CComplex) AS CComplex
OPERATOR * (BYVAL a AS DOUBLE, BYREF z AS CComplex) AS CComplex
OPERATOR * (BYREF z AS CComplex, BYVAL a AS DOUBLE) AS CComplex
OPERATOR / (BYREF leftside AS CComplex, BYREF rightside AS CComplex) AS CComplex
OPERATOR / (BYVAL a AS DOUBLE, BYREF z AS CComplex) AS CComplex
OPERATOR / (BYREF z AS CComplex, BYVAL a AS DOUBLE) AS CComplex
OPERATOR += (BYREF z AS CComplex)
OPERATOR -= (BYREF z AS CComplex)
OPERATOR *= (BYREF z AS CComplex)
OPERATOR /= (BYREF z AS CComplex)
OPERATOR - (BYREF z AS CComplex, BYVAL a AS DOUBLE) AS CComplex
OPERATOR ^ (BYREF value AS CComplex, BYREF power AS CComplex) AS CComplex
OPERATOR ^ (BYREF value AS CComplex, BYVAL power AS DOUBLE) AS CComplex
</code></pre>
<h4 id="examples-1">Examples</h4>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex(5, 6)
cpx2 = cpx1 + cpx2
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex = CComplex(5, 6)
cpx2 = cpx1 + 11
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex = CComplex(5, 6)
cpx2 = 11 + cpx1
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex = CComplex(5, 6)
cpx2 = cpx1 - cpx2
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex
cpx2 = cpx1 - 11
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex
cpx2 = 11 - cpx1
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex = CComplex(5, 6)
cpx2 = cpx1 * cpx2
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex
cpx2 = cpx1 * 11
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex
cpx2 = 11 * cpx1
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(5, 6)
DIM cpx2 AS CComplex = CComplex(2, 3)
cpx2 = cpx1 / cpx2
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(5, 6)
DIM cpx2 AS CComplex
cpx2 = cpx1 / 11
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(5, 6)
DIM cpx2 AS CComplex
cpx2 = 11 / cpx1
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex = CComplex(5, 6)
cpx1 += cpx2
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex = CComplex(5, 6)
cpx2 -= cpx1
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex = CComplex(5, 6)
cpx1 *= cpx2
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex = CComplex(5, 6)
cpx2 /= cpx1
</code></pre>
<pre><code>DIM cpx1 AS CComplex = CComplex(3, 4)
DIM cpx2 AS CComplex = -cpx1
</code></pre>
<h1 id="cabs-/-cmagnitude"><a name="CAbs"></a>CAbs / CMagnitude</h1>
<p>Returns the magnitude of this complex number.</p>
<pre><code>FUNCTION CAbs () AS DOUBLE
FUNCTION CMagnitude () AS DOUBLE
</code></pre>
<h4 id="example">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(2, 3)
PRINT cpx.CAbs
Output: 3.60555127546399
</code></pre>
<h1 id="cabs2-/-cnorm"><a name="CAbs2"></a>CAbs2 / CNorm</h1>
<p>Returns the squared magnitude of this complex number, otherwise known as the complex norm.</p>
<pre><code>FUNCTION CAbs2 () AS DOUBLE
FUNCTION CNorm () AS DOUBLE
</code></pre>
<h4 id="example-1">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(2, 3)
PRINT cpx.CAbs2
Output: 13
</code></pre>
<h1 id="cabssqr"><a name="CAbsSqr"></a>CAbsSqr</h1>
<p>Returns the absolute square (squared norm) of a complex number.</p>
<pre><code>FUNCTION CAbsSqr () AS DOUBLE
</code></pre>
<h4 id="example-2">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1.2345, -2.3456)
print cpx.CAbsSqr
Output: 7.025829610000001
</code></pre>
<h1 id="cadd"><a name="CAdd"></a>CAdd</h1>
<p>Adds a complex number.</p>
<pre><code>FUNCTION CAdd (BYREF z AS CComplex) AS CComplex
FUNCTION CAdd (BYVAL x AS DOUBLE, BYVAL y AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>z</em></td>
<td>The complex number to add.</td>
</tr>
<tr class="even">
<td><em>x, y</em></td>
<td>Double values representing the real and imaginary parts.</td>
</tr>
</tbody>
</table>
<h4 id="examples-2">Examples</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
DIM cpx2 AS CComplex = CComplex(2, 3)
cpx = cpx.CAdd(cpx2)
' --or-- cpx = cpx.CAdd(CComplex(2, 3))
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6) : cpx = cpx.CAdd(2, 3)
</code></pre>
<h1 id="caddimag"><a name="CAddImag"></a>CAddImag</h1>
<p>Adds an imaginary number.</p>
<pre><code>FUNCTION CAddImag (BYVAL x AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>y</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-3">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CAddImag(10)
</code></pre>
<h1 id="caddreal"><a name="CAddReal"></a>CAddReal</h1>
<p>Adds a real number.</p>
<pre><code>FUNCTION CAddReal (BYVAL x AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-4">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CAddReal(10)
</code></pre>
<h1 id="carccos-/-cacos"><a name="CArcCos"></a>CArcCos / CACos</h1>
<p>Returns the complex arccosine of this complex number.</p>
<pre><code>FUNCTION CArcCos () AS CComplex
FUNCTION CACos () AS CComplex
</code></pre>
<h4 id="example-5">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
print cpx.CArcCos(z)
Output: 0.9045568943023814 -1.061275061905036 * i
</code></pre>
<h1 id="carccosh-/-cacosh"><a name="CArcCosH"></a>CArcCosH / CACosH</h1>
<p>Returns the complex hyperbolic arccosine of this complex number. The branch cut is on the real axis, less than 1.</p>
<pre><code>FUNCTION CArcCosH () AS CComplex
FUNCTION CACosH () AS CComplex
</code></pre>
<h4 id="example-6">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
print cpx.CArcCosH
Output: 1.061275061905036 +0.9045568943023813 * i
</code></pre>
<h1 id="carccoshreal-/-cacoshreal"><a name="CArcCosHReal"></a>CArcCosHReal / CACosHReal</h1>
<p>Returns the complex hyperbolic arccosine of a real number.</p>
<pre><code>FUNCTION CArcCosHReal (BYVAL value AS DOUBLE) AS CComplex
FUNCTION CACosHReal (BYVAL value AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>value</em></td>
<td>A double value representing the real part of a complex number.</td>
</tr>
</tbody>
</table>
<h1 id="carccosreal-/-cacosreal"><a name="CArcCosReal"></a>CArcCosReal / CACosReal</h1>
<p>Returns the complex arccosine of a real number.<br> For a between -1 and 1, the function returns a real value in the range [0, pi].<br> For a less than -1 the result has a real part of pi and a negative imaginary part.<br> For a greater than 1 the result is purely imaginary and positive.</p>
<pre><code>FUNCTION CArcCosReal (BYVAL value AS DOUBLE) AS CComplex
FUNCTION CACosReal (BYVAL value AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>value</em></td>
<td>A double value representing the real part of a complex number.</td>
</tr>
</tbody>
</table>
<h4 id="example-7">Example</h4>
<pre><code>DIM cpx AS CComplex
print cpx.CArcCosReal(1) ' = 0 0 * i
print cpx.CArcCosReal(-1) ' = 3.141592653589793 0 * i
print cpx.CArcCosReal(2) ' = 0 +1.316957896924817 * i
</code></pre>
<h1 id="carccot-/-cacot"><a name="CArcCot"></a>CArcCot / CACot</h1>
<p>Returns the complex arccotangent of this complex number.</p>
<pre><code>FUNCTION CArcCot () AS CComplex
FUNCTION CACot () AS CComplex
</code></pre>
<h4 id="example-8">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
print cpx.CArcCot
Output: 0.5535743588970452 -0.4023594781085251 * i
</code></pre>
<h1 id="carccoth-/-cacoth"><a name="CArcCotH"></a>CArcCotH / CACotH</h1>
<p>Returns the complex hyperbolic arccotangent of this complex number.</p>
<pre><code>FUNCTION CArcCotH () AS CComplex
FUNCTION CACotH () AS CComplex
</code></pre>
<h4 id="example-9">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CArcCotH
Output: 0.4023594781085251 -0.5535743588970452 * i
</code></pre>
<h1 id="carccsc-/-cacsc"><a name="CArcCsc"></a>CArcCsc / CACsc</h1>
<p>Returns the complex arccosecant of this complex number.</p>
<pre><code>FUNCTION CArcCsc () AS CComplex
FUNCTION CACsc () AS CComplex
</code></pre>
<h4 id="example-10">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
print cpx.CArcCsc
Output: 0.4522784471511907 -0.5306375309525178 * i
</code></pre>
<h1 id="carccsch-/-cacsch"><a name="CArcCscH"></a>CArcCscH / CACscH</h1>
<p>Returns the complex hyperbolic arccosecant of this complex number.</p>
<pre><code>FUNCTION CArcCscH () AS CComplex
FUNCTION CACscH () AS CComplex
</code></pre>
<h4 id="example-11">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CArcCscH
Output: 0.5306375309525179 -0.4522784471511906 * i
</code></pre>
<h1 id="carccscreal-/-cacscreal"><a name="CArcCscReal"></a>CArcCscReal / CACscReal</h1>
<p>Returns the complex arccosecant of a real number.</p>
<pre><code>FUNCTION CArcCscReal (BYVAL value AS DOUBLE) AS CComplex
FUNCTION CACscReal (BYVAL value AS DOUBLE) AS CComplex
</code></pre>
<h4 id="example-12">Example</h4>
<pre><code>DIM cpx AS CComplex
print cpx.CArcCscReal(1)
Output: 1.570796326794897 0 * i
</code></pre>
<h1 id="carcsec-/-casec"><a name="CArcSec"></a>CArcSec / CASec</h1>
<p>Returns the complex arcsecant of this complex number.</p>
<pre><code>FUNCTION CArcSec () AS CComplex
FUNCTION CASec () AS CComplex
</code></pre>
<h4 id="example-13">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
print cpx.CArcSec
Output: 1.118517879643706 +0.5306375309525176 * i
</code></pre>
<h1 id="carcsech-/-casech"><a name="CArcSecH"></a>CArcSecH / CASecH</h1>
<p>Returns the complex hyperbolic arcsecant of this complex number.</p>
<pre><code>FUNCTION CArcSecH () AS CComplex
FUNCTION CASecH () AS CComplex
</code></pre>
<h4 id="example-14">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CArcSecH
Output: 0.5306375309525178 -1.118517879643706 * i
</code></pre>
<h1 id="carcsecreal-/-casecreal"><a name="CArcSecReal"></a>CArcSecReal / CASecReal</h1>
<p>Returns the complex arcsecant of a real number.</p>
<pre><code>FUNCTION CArcSecReal (BYVAL value AS DOUBLE) AS CComplex
FUNCTION CASecReal (BYVAL value AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>value</em></td>
<td>A double value representing the real part of a complex number.</td>
</tr>
</tbody>
</table>
<h4 id="example-15">Example</h4>
<pre><code>DIM cpx AS CComplex
print cpx.CArcSecReal(1.1)
Output: 0.4296996661514246 0 * i
</code></pre>
<h1 id="carcsin-/-casin"><a name="CArcSin"></a>CArcSin / CASin</h1>
<p>Returns the complex arcsine of this complex number. The branch cuts are on the real axis, less than -1 and greater than 1.</p>
<pre><code>FUNCTION CArcSin () AS CComplex
FUNCTION CASin () AS CComplex
</code></pre>
<h4 id="example-16">Example</h4>
<pre><code>DIM cpx AS CComplex
PRINT cpx.CArcSin(1, 1)
Output: 0.6662394324925152 +1.061275061905036 * i
</code></pre>
<h1 id="carcsinh-/-casinh"><a name="CArcSinH"></a>CArcSinH / CASinH</h1>
<p>Returns the complex hyperbolic arcsine of this complex number. The branch cuts are on the imaginary axis, below -i and above i.</p>
<pre><code>FUNCTION CArcSinH () AS CComplex
FUNCTION CASinH () AS CComplex
</code></pre>
<h4 id="example-17">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CArcSinH
Output: 1.061275061905036 +0.6662394324925153 * i
</code></pre>
<h1 id="carcsinreal-/-casinreal"><a name="CArcSinReal"></a>CArcSinReal / CASinReal</h1>
<p>Returns the complex arcsine of a real number.<br> For a between -1 and 1, the function returns a real value in the range [-pi/2, pi/2].<br> For a less than -1 the result has a real part of -pi/2 and a positive imaginary part.<br> For a greater than 1 the result has a real part of pi/2 and a negative imaginary part.</p>
<pre><code>FUNCTION CArcSinReal (BYVAL value AS DOUBLE) AS CComplex
FUNCTION CASinReal (BYVAL value AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>value</em></td>
<td>A double value representing the real part of a complex number.</td>
</tr>
</tbody>
</table>
<h4 id="example-18">Example</h4>
<pre><code>DIM cpx AS CComplex
PRINT cpx.CArcSinReal(1)
Output: 1.570796326794897 +0 * i
</code></pre>
<h1 id="carctan-/-catan"><a name="CArcTan"></a>CArcTan / CATan</h1>
<p>Returns the complex arctangent of this complex number. The branch cuts are on the imaginary axis, below -i and above i.</p>
<pre><code>FUNCTION CArcTan () AS CComplex
FUNCTION CATan () AS CComplex
</code></pre>
<h4 id="example-19">Example</h4>
<pre><code>DIM cpx AS CComplex
PRINT cpx.CArcTan(1, 1)
Output: 1.017221967897851 +0.4023594781085251 * i
</code></pre>
<h1 id="carctanh-/-catanh"><a name="CArcTanH"></a>CArcTanH / CATanH</h1>
<p>Returns the complex hyperbolic arctangent of this complex number. The branch cuts are on the real axis, less than -1 and greater than 1.</p>
<pre><code>FUNCTION CArcTanH () AS CComplex
FUNCTION CATanH () AS CComplex
</code></pre>
<h4 id="example-20">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CArcTanH
Output: 0.4023594781085251 +1.017221967897851 * i
</code></pre>
<h1 id="carctanhreal-/-catanhreal"><a name="CArcTanHReal"></a>CArcTanHReal / CATanHReal</h1>
<p>Returns the complex hyperbolic arctangent of a real number.</p>
<pre><code>FUNCTION CArcTanHReal (BYVAL value AS DOUBLE) AS CComplex
FUNCTION CATanHReal (BYVAL value AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>value</em></td>
<td>A double value representing the real part of a complex number.</td>
</tr>
</tbody>
</table>
<h1 id="carg-/-cargument-/-cphase"><a name="CArg"></a>CArg / CArgument / CPhase</h1>
<p>Returns the argument of this complex number.</p>
<pre><code>FUNCTION CArg () AS DOUBLE
FUNCTION CArgument () AS DOUBLE
FUNCTION CPhase () AS DOUBLE
</code></pre>
<h4 id="example-21">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 0)
PRINT cpx.CArg
Output: 0.0
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(0, 1)
PRINT cpx.CArg
Output: 1.570796326794897
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(0, -1)
PRINT cpx.CArg
Output: -1.570796326794897
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(-1, 0)
PRINT cpx.CArg
Output: 3.141592653589793
</code></pre>
<h1 id="cconjugate-/-cconj"><a name="CConjugate"></a>CConjugate / CConj</h1>
<p>Returns the complex conjugate of this complex number.</p>
<pre><code>FUNCTION CConjugate () AS CComplex
FUNCTION CConj () AS CComplex
</code></pre>
<h4 id="example-22">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CConjugate
</code></pre>
<h1 id="ccos"><a name="CCos"></a>CCos</h1>
<p>Returns the complex cosine of this complex number.</p>
<pre><code>FUNCTION CCos () AS CComplex
</code></pre>
<h4 id="example-23">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CCos
Output: 0.8337300251311491 -0.9888977057628651 * i
</code></pre>
<h1 id="ccosh"><a name="CCosH"></a>CCosH</h1>
<p>Returns the complex hyperbolic cosine of this complex number.</p>
<pre><code>FUNCTION CCosH () AS CComplex
</code></pre>
<h4 id="example-24">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CCosH
Output: 0.8337300251311491 +0.9888977057628651 * i
</code></pre>
<h1 id="ccot"><a name="CCot"></a>CCot</h1>
<p>Returns the complex cotangent of this complex number.</p>
<pre><code>FUNCTION CCot () AS CComplex
</code></pre>
<h4 id="example-25">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CCot
Output: 0.2176215618544027 -0.8680141428959249 * i
</code></pre>
<h1 id="ccoth"><a name="CCotH"></a>CCotH</h1>
<p>Returns the complex hyperbolic cotangent of this complex number.</p>
<pre><code>FUNCTION CCotH () AS CComplex
</code></pre>
<h4 id="example-26">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CCotH
Output: 0.8680141428959249 -0.2176215618544029 * i
</code></pre>
<h1 id="ccsc"><a name="CCsc"></a>CCsc</h1>
<p>Returns the complex cosecant of this complex number.</p>
<pre><code>FUNCTION CCsc () AS CComplex
</code></pre>
<h4 id="example-27">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CCsc
Output: 0.6215180171704285 -0.3039310016284265 * i
</code></pre>
<h1 id="ccsch"><a name="CCscH"></a>CCscH</h1>
<p>Returns the complex hyperbolic cosecant of this complex number.</p>
<pre><code>FUNCTION CCscH () AS CComplex
</code></pre>
<h4 id="example-28">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CCscH
Output: 0.3039310016284265 -0.6215180171704285 * i
</code></pre>
<h1 id="cdiv"><a name="CDiv"></a>CDiv</h1>
<p>Divides by a complex number.<br> Divides by a real and an imaginary number.</p>
<pre><code>FUNCTION CDiv (BYREF z AS CComplex) AS CComplex
FUNCTION CDiv (BYVAL x AS DOUBLE, BYVAL y AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>z</em></td>
<td>A complex number.</td>
</tr>
<tr class="even">
<td><em>x, y</em></td>
<td>Double values representing the real and imaginary parts.</td>
</tr>
</tbody>
</table>
<h4 id="example-29">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
DIM cpx2 AS CComplex = CComplex(2, 3)
cpx = cpx.CDiv(cpx2)
' --or-- cpx = cpx.CDiv(CComplex(2, 3))
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CDiv(2, 3)
</code></pre>
<h1 id="cdivimag"><a name="CDivImag"></a>CDivImag</h1>
<p>Divides by an imaginary number.</p>
<pre><code>FUNCTION CDivImag (BYVAL y AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>y</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-30">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CDivImag(10)
</code></pre>
<h1 id="cdivreal"><a name="CDivReal"></a>CDivReal</h1>
<p>Divides by a real number.</p>
<pre><code>FUNCTION CDivReal (BYVAL x AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-31">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CDivReal(10)
</code></pre>
<h1 id="cexp"><a name="CExp"></a>CExp</h1>
<p>Returns the complex exponential of this complex number.</p>
<pre><code>FUNCTION CExp () AS CComplex
</code></pre>
<h4 id="example-32">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CExp
Output: 1.468693939915885 +2.287355287178842 * i
</code></pre>
<h1 id="cimag"><a name="CImag"></a>CImag</h1>
<p>Gets/sets the imaginary part of a complex number.</p>
<pre><code>PROPERTY CImag () AS DOUBLE
PROPERTY CImag (BYVAL x AS DOUBLE)
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-33">Example</h4>
<pre><code>DIM cpx AS CComplex : cpx.CImag = 4
DIM d AS DOUBLE = cpx.CImag
</code></pre>
<h1 id="clog"><a name="CLog"></a>CLog</h1>
<p>Returns the complex natural logarithm (base e) of this complex number. The branch cut is the negative real axis.</p>
<pre><code>FUNCTION CLog () AS CComplex
FUNcTION CLog (BYVAL baseValue AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>baseValue</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="examples-3">Examples</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CLog
Output: 0.3465735902799727 +0.7853981633974483 * i
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(0, 0)
PRINT cpx.CLog
Output: -1.#INF
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CLog(10)
Output: 0.1505149978319906 +0.3410940884604603 * i
</code></pre>
<h1 id="clog10"><a name="CLog10"></a>CLog10</h1>
<p>Returns the complex base-10 logarithm of this complex number.</p>
<pre><code>FUNCTION CLog10 () AS CComplex
</code></pre>
<h4 id="example-34">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CLog10
Output: 0.1505149978319906 +0.3410940884604603 * i
</code></pre>
<h1 id="clogabs"><a name="CLogAbs"></a>CLogAbs</h1>
<p>Returns the natural logarithm of the magnitude of the complex number z, log|z|. It allows an accurate evaluation of \log|z| when |z| is close to one. The direct evaluation of log(CAbs(z)) would lead to a loss of precision in this case.</p>
<pre><code>FUNCTION CLogAbs () AS DOUBLE
</code></pre>
<h4 id="example-35">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1.1, 0.1)
PRINT cpx.CLogAbs
Output: 0.09942542937258279
</code></pre>
<h1 id="cmodulus-/-cmod"><a name="CModulus"></a>CModulus / CMod</h1>
<p>Returns the modulus of a complex number.</p>
<pre><code>FUNCTION CModulus () AS DOUBLE
FUNCTION CMod () AS DOUBLE
</code></pre>
<h4 id="example-36">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(2.3, -4.5)
print cpx.CModulus
Output: 5.053711507397311
</code></pre>
<h1 id="cmul"><a name="CMul"></a>CMul</h1>
<p>Multiplies by a complex number.<br> Multiplies by a real and an imaginary number.</p>
<pre><code>FUNCTION CMul (BYREF z AS CComplex) AS CComplex
FUNCTION CMul (BYVAL x AS DOUBLE, BYVAL y AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>z</em></td>
<td>A complex number.</td>
</tr>
<tr class="even">
<td><em>x, y</em></td>
<td>Double values representing the real and imaginary parts.</td>
</tr>
</tbody>
</table>
<h4 id="examples-4">Examples</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
DIM cpx2 AS CComplex = CComplex(2, 3)
cpx = cpx.CMul(cpx2)
' --or-- cpx = cpx.CMul(CComplex(2, 3))
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CMul(2, 3)
</code></pre>
<h1 id="cmulimag"><a name="CMulImag"></a>CMulImag</h1>
<p>Multiplies by an imaginary number.</p>
<pre><code>FUNCTION CMulImag (BYVAL y AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>y</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-37">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cx = cpx.CMulImag(3)
</code></pre>
<h1 id="cmulreal"><a name="CMulReal"></a>CMulReal</h1>
<p>Multiplies by a real number.</p>
<pre><code>FUNCTION CMulReal (BYVAL x AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-38">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CMulReal(2)
</code></pre>
<h1 id="cnegate-/-cneg-/-cnegative"><a name="CNegate"></a>CNegate / CNeg / CNegative</h1>
<p>Negates the complex number.</p>
<pre><code>FUNCTION CNeg (BYREF z AS _complex) AS _complex
FUNCTION CNegate (BYREF z AS _complex) AS _complex
FUNCTION CNegative (BYREF z AS _complex) AS _complex
</code></pre>
<h1 id="cnthroot"><a name="CNthRoot"></a>CNthRoot</h1>
<p>Returns the kth nth root of a complex number where k = 0, 1, 2, 3,...,n - 1.<br> De Moivre's formula states that for any complex number x and integer n it holds that<br> cos(x)+ i<em>sin(x))^n = cos(n</em>x) + i<em>sin(n</em>x)<br> where i is the imaginary unit (i2 = -1).<br> Since z = r<em>e^(i</em>t) = r * (cos(t) + i sin(t))<br> where<br> z = (a, ib)<br> r = modulus of z<br> t = argument of z<br> i = sqrt(-1.0)<br> we can calculate the nth root of z by the formula:<br> z^(1/n) = r^(1/n) * (cos(x/n) + i sin(x/n))<br> by using log division.</p>
<pre><code>FUNCTION CNthRoot (BYVAL n AS LONG, BYVAL k AS LONG = 0) AS _complex
</code></pre>
<h4 id="example-39">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(2.3, -4.5)
DIM n AS LONG = 5
FOR i AS LONG = 0 TO n - 1
   print CStr(cpx.CNthRoot(n, i))
NEXT
Output:
 1.349457704883236  -0.3012830564679053 * i
 0.7035425781022545 +1.190308959128094 * i
-0.9146444790833151 +1.036934450322577 * i
-1.268823953798186  -0.5494482247230521 * i
 0.1304681498960107 -1.376512128259714 * i
</code></pre>
<h1 id="cpolar"><a name="CPolar"></a>CPolar</h1>
<p>Sets the complex number from the polar representation.</p>
<pre><code>FUNCTION CPolar (BYVAL r AS DOUBLE, BYVAL theta AS DOUBLE)
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>r</em></td>
<td>The modulus of complex number.</td>
</tr>
<tr class="even">
<td><em>theta</em></td>
<td>The angle with the positive direction of x-axis.</td>
</tr>
</tbody>
</table>
<h1 id="cpow"><a name="CPow"></a>CPow</h1>
<p>Returns this complex number raised to a complex power.<br> Returns this complex number raised to a real number.</p>
<pre><code>FUNCTION CPow (BYREF power AS CComplex) AS CComplex
FUNCTION CPow (BYVAL power AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>power</em></td>
<td>A complex or a double number.</td>
</tr>
</tbody>
</table>
<h4 id="examples-5">Examples</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
DIM b AS CComplex = CComplex(2, 2)
PRINT cpx.CPow(b)
Output: -0.2656539988492412 +0.3198181138561362 * i
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CPow(2)
Output: 1.224606353822378e-016 +2 * i
</code></pre>
<h1 id="creal"><a name="CReal"></a>CReal</h1>
<p>Gets/sets the real part of a complex number.</p>
<pre><code>PROPERTY CReal () AS DOUBLE
PROPERTY CReal (BYVAL x AS DOUBLE)
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-40">Example</h4>
<pre><code>DIM cpx AS CComplex : cpx.CReal = 3
DIM d AS DOUBLE = cpx.CReal
</code></pre>
<h1 id="creciprocal-/-cinverse"><a name="CReciprocal"></a>CReciprocal / CInverse</h1>
<p>Returns the inverse, or reciprocal, of a complex number.</p>
<pre><code>FUNCTION CReciprocal () AS CComplex
FUNCTION CInverse () AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-41">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
Print cpx.CReciprocal
Output: 0.5 -0.5 * i
</code></pre>
<h1 id="csec"><a name="CSec"></a>CSec</h1>
<p>Returns the complex secant of this complex number.</p>
<pre><code>FUNCTION CSec () AS CComplex
</code></pre>
<h4 id="example-42">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CSec
Output: 0.4983370305551869 +0.591083841721045 * i
</code></pre>
<h1 id="csech"><a name="CSecH"></a>CSecH</h1>
<p>Returns the complex hyperbolic secant of this complex number.</p>
<pre><code>FUNCTION CSecH () AS CComplex
</code></pre>
<h4 id="example-43">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CSecH
Output: 0.4983370305551869 -0.591083841721045 * i
</code></pre>
<h1 id="cset-/-crect"><a name="CSet"></a>CSet / CRect</h1>
<p>Uses the cartesian components (x,y) to set the real and imaginary parts of the complex number.</p>
<pre><code>PROPERTY CSet (BYVAL x AS DOUBLE, BYVAL y AS DOUBLE)
PROPERTY CRect (BYVAL x AS DOUBLE, BYVAL y AS DOUBLE)
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x, y</em></td>
<td>Double values.</td>
</tr>
</tbody>
</table>
<h4 id="example-44">Example</h4>
<pre><code>DIM cpx AS CComplex : cpx.CSet = 3, 4
DIM cpx AS CComplex : cpx.CRect = 3, 4
</code></pre>
<h1 id="csgn"><a name="CSgn"></a>CSgn</h1>
<p>Returns the sign of this complex number.<br> If number is greater than zero, then CSgn returns 1.<br> If number is equal to zero, then CSgn returns 0.<br> If number is less than zero, then CSgn returns -1.</p>
<pre><code>PROPERTY CSgn () AS LONG
</code></pre>
<h1 id="csin"><a name="CSin"></a>CSin</h1>
<p>Returns the complex sine of this complex number.</p>
<pre><code>PROPERTY CSin () AS CSin
</code></pre>
<h4 id="example-45">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CSin
Output: 1.298457581415977 +0.6349639147847361 * i
</code></pre>
<h1 id="csinh"><a name="CSinH"></a>CSinH</h1>
<p>Returns the complex hyperbolic sine of this complex number.</p>
<pre><code>FUNCTION CSinH () AS CComplex
</code></pre>
<h4 id="example-46">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CSinH
Output: 0.6349639147847361 +1.298457581415977 * i
</code></pre>
<h1 id="csqr-/-csqrt"><a name="CSqr"></a>CSqr / CSqrt</h1>
<p>Returns the square root of the complex number z. The branch cut is the negative real axis. The result always lies in the right half of the complex plane.</p>
<pre><code>FUNCTION CSqr () AS CComplex
FUNCTION CSqrt () AS CComplex
</code></pre>
<p>Returns the complex square root of the real number x, where x may be negative.</p>
<pre><code>FUNCTION CSqr (BYVAL value AS DOUBLE) AS CComplex
FUNCTION CSqrt (BYVAL value AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>value</em></td>
<td>A double value representing a real number.</td>
</tr>
</tbody>
</table>
<h4 id="examples-6">Examples</h4>
<pre><code>DIM cpx AS CComplex = CComplex(2, 3)
PRINT cpx.CSqrt
Output: 1.67414922803554 +0.895977476129838 * i
</code></pre>
<p>Compute the square root of -1:</p>
<pre><code>DIM cpx AS CComplex = CComplex(-1)
PRINT cpx.CSqr
Output: 0 +1.0 * i
</code></pre>
<h1 id="csub"><a name="CSub"></a>CSub</h1>
<p>Subtracts a complex number.</p>
<pre><code>FUNCTION CSub (BYREF z AS CComplex) AS CComplex
FUNCTION CSub (BYVAL x AS DOUBLE, BYVAL y AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>z</em></td>
<td>The complex number to subtract.</td>
</tr>
<tr class="even">
<td><em>x, y</em></td>
<td>Double values representing the real and imaginary parts.</td>
</tr>
</tbody>
</table>
<h4 id="examples-7">Examples</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
DIM cpx2 AS CComplex = CComplex(2, 3)
cpx = cpx.CSub(cpx2)
' --or-- cpx = cpx.CSub(CComplex(2, 3))
</code></pre>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CSub(2, 3)
</code></pre>
<h1 id="csubimag"><a name="CSubImag"></a>CSubImag</h1>
<p>Subtracts an imaginary number.</p>
<pre><code>FUNCTION CSubImag (BYVAL y AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>y</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-47">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cx = cpx.CSubImag(3)
</code></pre>
<h1 id="csubreal"><a name="CSubReal"></a>CSubReal</h1>
<p>Subtracts a real number.</p>
<pre><code>FUNCTION CSubReal (BYVAL x AS DOUBLE) AS CComplex
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-48">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(5, 6)
cpx = cpx.CSubReal(2)
</code></pre>
<h1 id="cswap"><a name="CSwap"></a>CSwap</h1>
<p>Exchanges the contents of two complex numbers.</p>
<pre><code>SUB CSwap (BYREF z AS CComplex)
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>z</em></td>
<td>The complex number to swap.</td>
</tr>
</tbody>
</table>
<h1 id="ctan"><a name="CTan"></a>CTan</h1>
<p>Returns the complex tangent of this complex number.</p>
<pre><code>FUNCTION CTan () AS CComplex
</code></pre>
<h4 id="example-49">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CTan
Output: 0.2717525853195117 +1.083923327338695 * i
</code></pre>
<h1 id="ctanh"><a name="CTanH"></a>CTanH</h1>
<p>Returns the complex hyperbolic tangent of this complex number.</p>
<pre><code>FUNCTION CTanH () AS CComplex
</code></pre>
<h4 id="example-50">Example</h4>
<pre><code>DIM cpx AS CComplex = CComplex(1, 1)
PRINT cpx.CTanH
Output: 1.083923327338695 +0.2717525853195119 * i
</code></pre>
<h1 id="arccosh"><a name="ArcCosH"></a>ArcCosH</h1>
<p>Calculates the inverse hyperbolic cosine.</p>
<pre><code>FUNCTION ArcCosH (BYVAL x AS DOUBLE) AS DOUBLE
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-51">Example</h4>
<pre><code>DIM AS double pi = 3.1415926535
DIM AS double x, y
DIM cpx AS CComplex
x = cosh(pi / 4)
y = cpx.ArcCosH(x)
print &quot;cosh = &quot;, pi/4, x
print &quot;ArcCosH = &quot;, x, y

Output:
cosh =  0.785398163375      1.324609089232506
acosh = 1.324609089232506   0.7853981633749999
</code></pre>
<h1 id="arctanh"><a name="ArcTanH"></a>ArcTanH</h1>
<p>Returns the inverse hyperbolic tangent of a number.</p>
<pre><code>FUNCTION ArcTanH (BYVAL x AS DOUBLE) AS DOUBLE
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="example-52">Example</h4>
<pre><code>DIM cpx AS CComplex
print cpx.ArcTanh(0.76159416)
Output: 1.00000000962972

print cpx.ArcTanH(-0.1)
Output: -0.1003353477310756
</code></pre>
<h1 id="isinfinity-/-isinf"><a name="IsInfinity"></a>IsInfinity / IsInf</h1>
<p>Determines whether the argument is an infinity.</p>
<pre><code>FUNCTION IsInfinity (BYVAL x AS DOUBLE) AS LONG
FUNCTION IsInf (BYVAL x AS DOUBLE) AS LONG
</code></pre>
<table>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>x</em></td>
<td>A double value.</td>
</tr>
</tbody>
</table>
<h4 id="remarks-1">Remarks</h4>
<p>Returns +1 if x is positive infinity, -1 if x is negative infinity and 0 otherwise.</p>
</body>
</html>

